@extends('web.layout')

@section('content')
    <div class="layui-container fly-marginTop fly-user-main">
        @include('web.user.nav')

        <div class="fly-panel fly-panel-user" pad20>
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title" id="LAY_mine">
                    <li class="layui-this" lay-id="info">用户提现</li>
                    <li lay-id="withdraw-log">提现记录</li>
                </ul>
                <div class="layui-tab-content" style="padding: 20px 0;">
                    <div class="layui-form layui-form-pane layui-tab-item layui-show">
                        <form method="post" action="{{ url('/withdraw-store') }}">
                            <div class="layui-form-item">
                                <label for="L_username" class="layui-form-label" style="border-style:none;background-color:transparent">账户余额</label>

                                <div class="layui-form-mid">&nbsp;&nbsp;&nbsp; <span class="star-red">{{ Auth::user()->amount }}</span> 元</div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_amount" class="layui-form-label">提现金额</label>
                                <div class="layui-input-inline">
                                    <input type="number" id="L_amount" name="amount" required lay-verify="required" placeholder="请输入提现金额" autocomplete="off" value="" class="layui-input">
                                </div>
                                <div class="layui-form-mid">&nbsp;元 &nbsp;<span class="star-red">手续费为提现金额的3%,提现不足100元则按3元收取，7-15个工作日到账,节假日顺延</span></div>
                            </div>

                            <div class="layui-form-item">
                                <button class="layui-btn recharge-btn" key="set-mine" lay-filter="*" lay-submit>发起提现</button>
                            </div>
                        </form>
                    </div>
                    <div class="layui-form layui-form-pane layui-tab-item">
                        <table class="layui-hide" id="table-list"></table>
                    </div>
                </div>

            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        layui.use(['form','table'], function(){
            var $ = layui.$
                ,form = layui.form
                ,layer = layui.layer
                ,table = layui.table;

            table.render({
                elem: '#table-list'
                ,url: "{{ url('/withdraw-list') }}"
                ,cellMinWidth: 100
                ,cols: [[
                    {field:'trade_no', width:'25%', title: '流水号'}
                    ,{field:'amount', title: '提现金额'}
                    ,{field:'poundage', title: '手续费'}
                    ,{field:'status_name', title: '状态',templet:function(d){
                        return '<span class="layui-badge '+d.status_color+'">'+d.status_name+'</span>';
                     }}
                    ,{field:'updated_at', title: '更新时间'}
                ]]
                ,page: {
                    layout: ['prev', 'page', 'next']
                }
            });

        });
    </script>
@endsection